#include <iostream>
#include <ctime>
#include <memory>
#include <mysql/mysql.h>
#include "Connection.h"
#include "mysql_pool.h"
//压力测试

using namespace std;

int main()
{
    clock_t begin = clock();
    Connection_pool *cp = Connection_pool::getConnectionPool();
    for (int i = 0; i < 1000; i++)
    {

        char sql[1024] = {0};
        sprintf(sql, "insert into epm(id,name) values('%d','%s')", i, "赵四");

        shared_ptr<Connection> sp = cp->getConnection();
        sp->update(sql);
    }
    clock_t end = clock();
    std::cout << (end - begin) << "ms" << std::endl;

    return 0;
}